// pages/cart/cart.js
import { cartList,tuList } from "../../utils/interface"
Page({
  onLoad() {
    this.getlist()
    this.gettu()
  },
  async getlist(){
      let {data:res} = await cartList().catch(err=>err)
      let list =res.data
      this.setData({
        list
      })
  },
  async gettu(){
      let {data:res} = await tuList().catch(err=>err)
      let tu =res.data
      this.setData({
        tu
      })
  },
  myClick(e){
    let type = e.currentTarget.dataset.type
    if(!type){
      this.gettu()
    }else{
      let tu = this.data.list.filter(item=>{
        return item.type.includes(type)
      })
      this.setData({
        tu
      })
    }
  }

 
})